<template>
  <div class="play">
    <div class="title_line">
      <div class="line_first">
        <div >
          <span class="title" style="font-size: 38px;">注册</span>
        </div>
      </div>
      <div class="loginl">
        
        <el-input v-model="user.username" placeholder="昵称"></el-input>
        <div class="marin"></div>
        <el-input v-model="user.password" placeholder="密码"  show-password ></el-input>
         <div class="marin"></div>
        <el-input v-model="user.phone" placeholder="手机号码"></el-input>
         <div class="marin"></div>
      <div class="loginl_l"> 
          <el-input v-model="code" placeholder="短信验证码"></el-input>
             <el-button type="primary" plain>点击获取</el-button>
      </div>
      <div class="res-agree">
        <el-checkbox v-model="checked" >我已同意</el-checkbox>
        <a href="#">《哔哩哔哩弹幕网用户使用协议》</a>
        和
        <a href="#">《哔哩哔哩隐私政策》</a>
      </div>
     <el-button class="primary" type="info" v-bind:disabled="!checked" @click="info">注册</el-button>
     <div class="deng">
       <a href="#">已有账号，直接登入></a>
     </div>
      </div>
      
    </div>
  </div>  
</template>

<script>
import '../css/play.css'
import axios from 'axios'
export default {
  data() {
    return {

       checked: true,
       user: {}, //用户信息,
       code:'',
    }
  },
  watch: {
    checked:function(old,news)
    {
      console.log(news);
    }
    
  },
  methods: {
      info()
      {
           axios.post("http://localhost:8081/user/token?code="+this.code,this.user).then(res=>
        {
          
            if(res.data.state)
            {
                alert(res.data.msg+"进入登入页面");
               location.href="http://localhost:8080/#/login"
            }else
            {
                    alert(res.data.msg)
            }
        });
      }

  },

}
</script>

<style>
    
</style>